<!--
描述：慕课模块-章审核
开发人：zhaohang
开发日期：2019年11月7日
-->
<template lang="pug">
  kalix-dialog.user-add(title='审核' bizKey="adminModule" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL" :submitBefore="submitBefore")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="审核" prop="isChapterOpen")
        el-select(v-model="temp"  placeholder="请选择")
          el-option(v-for="item in option" v-bind:key="item.value" v-bind:value="item.value" v-bind:label="item.label")
</template>

<script type="text/ecmascript-6">
  import {baseModulesURL} from '../../config.toml'
  import FormModel from './moduleModel'
  export default {
    name: 'moocChapterExamine',
    data() {
      return {
        temp: null,
        fileList: [],
        formModel: Object.assign({}, FormModel),
        option: [{
          value: 1,
          label: '通过'
        }, {
          value: 2,
          label: '不通过'
        }
        ],
        labelWidth: '120px',
        targetURL: baseModulesURL
      }
    },
    mounted() {
      console.log('this.formModel=============', this.formModel)
      this.temp = this.formModel.isChapterOpen
      if (this.temp === 0) {
        this.temp = '待审核'
      }
      if (this.temp === 1) {
        this.temp = '通过'
      }
      if (this.temp === 1) {
        this.temp = '不通过'
      }
    },
    methods: {
      submitBefore(baseDialog, callBack) {
        if (baseDialog.formModel.isChapterOpen === '否') {
          this.formModel.isChapterOpen = 2
        } else {
          this.formModel.isChapterOpen = 1
        }
        this.formModel.isChapterOpen = this.temp
        callBack()
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
